from flask_login import UserMixin

from app.exts import db
from datetime import datetime
class UserModel(db.Model,UserMixin):
    __tablename__='user'
    id=db.Column(db.Integer,primary_key=True,autoincrement=True)
    username=db.Column(db.String(100),nullable=False,unique=True)
    password=db.Column(db.String(200),nullable=False)
    email=db.Column(db.String(100),nullable=False,unique=True)
    avatar=db.Column(db.String(100))
    job=db.Column(db.String(100))
    profile=db.Column(db.Text)
    phone=db.Column(db.String(20))
    join_time=db.Column(db.DateTime,default=datetime.now)

    blogs=db.relationship("BlogModel",back_populates="author")